<template>
  <div class="girl">
      <h1>girl</h1>
      <p>{{toy}}</p>
      <p>{{cake}}</p>
      <button @click="send">把玩具借给哥哥</button>
  </div>
</template>

<script>
export default {
    name:"girl",
    data(){
        return{
            toy:"变形金刚",
            cake:""
        }
    },
    mounted(){
        this.eventBus.$on("send-cake",(cake)=>{
            this.cake =cake
        })
    },
    methods:{
        send(){
            this.eventBus.$emit("send-toy",this.toy)
        }
    }
}
</script>

<style scoped>
.girl{
    width: 200px;
    height: 200px;
    border: 1px solid pink;
}
</style>>

